﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using WebChatApi.Common.Interface;

namespace WebChatApi.Common
{
    /// <summary>
    /// Class for mobile synchronize request.
    /// </summary>
    [DataContract]
    public class MobileSynchronizeRequest
    {
        /// <summary>
        /// Gets or sets the culture info.
        /// </summary>
        /// <value>
        /// The culture info.
        /// </value>
        [DataMember]
        public string CultureInfo
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the last sync stamp.
        /// This value is as same as value in property <c>LastSyncStampString</c>. 
        /// And this property will be used to business logics and WCF XML serialization.
        /// So if you are using JSON format, please use <c>LastSyncStampString</c>.
        /// </summary>
        /// <value>
        /// The last sync stamp.
        /// </value>
        [DataMember]
        public DateTime? LastSyncStamp
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the last sync stamp string.
        /// Format: yyyy-MM-ddTHH:mm:ss.fffzzz
        /// Sample: 2013-01-02T03:45:23.215+08:00
        /// This value is as same as value in property <c>LastSyncStamp</c>. 
        /// And this property will be only used to JSON format serialization.
        /// So if the property is used to business logics and WCF XML serialization, please use <c>LastSyncStamp</c>.
        /// </summary>
        /// <value>
        /// The last sync stamp string.
        /// </value>
        public string LastSyncStampString
        {
            get
            {
                return this.LastSyncStamp == null ? string.Empty : DateTimeUtil.DateTimeToFullString(this.LastSyncStamp.Value);
            }
            set
            {
                this.LastSyncStamp = string.IsNullOrWhiteSpace(value) ? null : DateTimeUtil.FullStringToDateTime(value, this.LastSyncStamp.Value) as DateTime?;
            }
        }

        /// <summary>
        /// Gets or sets the count.
        /// </summary>
        /// <value>
        /// The count.
        /// </value>
        [DataMember]
        public int Count
        {
            get;
            set;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="MobileSynchronizeRequest"/> class.
        /// </summary>
        public MobileSynchronizeRequest()
            : base()
        {
        }
    }
}
